package io;

import java.io.*;

public class Test6 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        File dir = new File(".");
        File[] subs = dir.listFiles(f->f.getName().endsWith(".obj"));
        for(File sub :subs){
            FileInputStream fis = new FileInputStream(sub);
            ObjectInputStream ois = new ObjectInputStream(fis);
            Object obj = ois.readObject();//反序列化
            if(obj instanceof User){
                User user = (User)obj;
                System.out.println(user);
            }
            ois.close();
        }
    }
}
